/**
 * Founded in 2017/7/31
 * @ jquery-1.12.3.min.js
 * This is a public JS file, 
 * to facilitate the official website page or other topics page calls,
 * the whole JS is the object of the way to store functions, 
 * to facilitate subsequent increase, delete, change, check
 * Note: the later modifications and additional functions require compatibility with the previous functions.
 * Annotations are required to explain the function and add time
 */


var ndGlobal = {
    // windows width
	winWidth : parseInt($(window).width()),
    // 最小宽度
	smallWindowWidth : 1500,
    // 判断电话正则
    checkPhone : /^1[34578]\d{9}$/,
    // 判断邮箱正则
    checkMail : /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,
    // 判断最少输入字符 
    checkWordsNum : /^.{4,}$/,
    // 提交地址
    formUrl : 'https://px.thea.cn/Listen/ListenAddAll',
	// 当屏幕缩小时执行的函数；
	changeScreen : function(fn){
		if (ndGlobal.winWidth < ndGlobal.smallWindowWidth) {
			fn && fn();
		}
	},
    // 遍历对象
    isTraverse : function(a,b){
        for(var i in b){
            a[i] = b[i];
        }
        return a;  
    },
    // 阻止默认行为
    stopDefault : function(e){
        //阻止默认浏览器动作(W3C) 
        var e = e || window.event;
        if (e && e.preventDefault){ 
            e.preventDefault(); 
        //IE中阻止函数器默认动作的方式 
        }else if(window.event){
            window.event.returnValue = false;
        } 
        return false;
    },
    // 阻止事件冒泡 
    stopEvent : function(e){
        var e=arguments.callee.caller.arguments[0] || e;
        if(e && e.stopPropagation){
            // this code is for Mozilla and Opera
            e.stopPropagation();
        }else if(window.event){
            // this code is for IE
            window.event.cancelBubble = true;
        }
    },
    // 解析默认参数
    /**
     * Return an object
     * cityid-areaid-ntypeid-schoolid-courseid-classid-vip-content
     */
    defaultParameter : function(){
        var dataId = $('.defaults_dataid').attr('data-id');
        var idArr = dataId.split('-');
        var idkey = 'cityid-areaid-ntypeid-schoolid-courseid-classid-vip-content'.split('-');
        var defaultJson = {};
        for (var i = 0; i < idArr.length; i++) {
            defaultJson[idkey[i]] = idArr[i];
        };
        return defaultJson;  
    },
    // 根据默认数据包含的城市id来调取城市
    // ele 是接受传过来的区域数据，c是默认城市id；
    getCity : function(par,c){
        var defaultsC = c;
        var $par = par
        // 没有默认城市
        if (defaultsC == 0 && $('.user-city',$par).size()>=1) {
            $.ajax({
                url:'https://proxytheapx.thea.cn/Px/City/ajaxGetProxyCity',
                type:'get',
                dataType:'jsonp',
                jsonp: "callback",
                jsonpCallback:"call",
                success:function($data){
                    if($data){
                        var $html = '';
                        var $length = 0;
                        for(ciyt in $data){
                            $length++;
                            $html +='<li data-id="'+ $data[ciyt]['id'] +'">'+ $data[ciyt]['cityname'] +'</li>';
                        }
                        $('.user-city',$par).empty().html('<p></p><div class="custom-select-con"><div class="scroll-bar-con"><ul class="scroll-bar"></ul></div></div>')
                        $('.user-city ul',$par).html($html);
                        ndGlobal.customSelect($('.user-city',$par));
                    }else{
                        console.log(111);
                    }
                }   
            })
        }else if (defaultsC != 0) {           //有默认城市
            // 改变样式
            if($('.user-city',$par).size()>=1){
                console.log(2);
                $('.user-city',$par).css('background-image','none');
            }
            // 请求城市
            if ($('.user-city',$par).size()>=1) {
                console.log(3);
                $.ajax({
                    url:'https://proxytheapx.thea.cn/Px/City/ajaxGetCityInfo/id/'+defaultsC,
                    type:'get',
                    dataType:'jsonp',
                    jsonp: "callback",
                    jsonpCallback:"call",
                    success:function($data){
                        if ($data) {
                            $('.user-city',$par).empty().html('<p>'+$data.cityname+'</p>')
                        }else{
                            console.log(111);
                        }
                    }   
                });
            };
            ndGlobal.getArea($par,defaultsC);
        };
    },
    // 根据城市id调取城市内的区域
    getArea : function(par,c){
        if ($('.user-area',par).size()>=1 && c != 0) {
            console.log(5);
            // 请求地区；
            $.ajax({
                url:'https://px.thea.cn/Px/City/ajaxGetArea/id/'+ c,
                type:'get',
                dataType:'jsonp',
                jsonp: "callback",
                jsonpCallback:"call"+(new Date()).getTime(),
                success:function($data){
                    if($data){
                        var $ahtml = '';
                        var $ashtml = '<option selected="selected" value="">请选择区域</option>';
                        var $alength = 0;
                        for(area in $data){
                            $alength++;
                            $ahtml +='<li data-id="'+ $data[area]['id'] +'">'+ $data[area]['areaname'] +'</li>';
                            $ashtml += '<option value="' + $data[area]['id'] + '">' + $data[area]['areaname'] + '</option>';
                        }
                        $('select.user-area',par).html($ashtml)
                        $('div.user-area',par).empty().html('<p></p><div class="custom-select-con"><div class="scroll-bar-con"><ul class="scroll-bar"></ul></div></div>')
                        $('div.user-area ul',par).html($ahtml);
                        ndGlobal.customSelect($('.user-area',par));
                    }
                }
            })
        };
    },
	// 自定义滚动条
	customScroll:function(ele,options){
        var that = ele;
        var o = {
            scrollBarCon    : $('.scroll-bar-con',that),                 // 滚动内容的容器
            scrollBar       : $('.scroll-bar',that),                     // 滚动的内容
            scrollTrack     : 'scroll-track',                            // 滚动条轨道的样式
            scrollThumb     : 'scroll-thumb'                             // 滚动条滑块的样式
        }
        if (options) {
            ndGlobal.isTraverse(o,options);
        };
        var scrollBarCon = o.scrollBarCon;                               // 滚动内容的父级
        var scrollBar = o.scrollBar;                                     // 滚动的内容
        var factH = scrollBar.height();                                  // 滚动内容的高度
        var wrapH = scrollBarCon.height();                               // 父级的高度
        var scrollTrack = o.scrollTrack;                                 // 滚动条轨道
        var scrollThumb = o.scrollThumb;                                 // 滚动条滑块
        // 判断是否需要创建滚动条轨道
        if (factH>wrapH) {
            // 重新创建轨道
            if (that.attr('scroll') == '2' || that.attr('scroll') == 2) {
                $(scrollTrack).remove();
            };
            if(that.attr('scroll') == undefined || that.attr('scroll') == '2' || that.attr('scroll') == 2){
                that.attr('scroll','1');
                $('<div>',{
                    'class' : scrollTrack,
                    html : '<div class="'+scrollThumb+'"></div>'
                }).appendTo(that);
            }      
        }else{
            $(scrollTrack).remove();
            scrollBarCon.mousewheel(function(down,e){
                return;
            })
            return;
        }
        var scrollTrackEle = that.find('.'+scrollTrack);
        var scrollThumbEle = that.find('.'+scrollThumb);
        var scrollTrackH = scrollTrackEle.height();                             //滚动条轨道的高度
        var scrollThumbH = scrollThumbEle.height();                             //滚动的滑块的高度
        var disY;
        var newY;
        var newT;
        var ulNewT;
        scrollThumbEle.on('mousedown',function(e){
            ndGlobal.stopDefault(e);
            var oldY = e.pageY;
            var oldT = scrollThumbEle.position().top;
            var uloldT = scrollBar.position().top;
            $(document).on('mousemove',function(e){
                newY = e.pageY;
                disY = newY - oldY;
                newT = disY+oldT;
                ulNewT = -disY*(factH-wrapH)/(scrollTrackH-scrollThumbH)+uloldT;
                if (newT<=0) 
                {
                    newT = 0;
                    ulNewT = 0;
                }
                else if(newT>=scrollTrackH-scrollThumbH)
                {
                    newT=scrollTrackH-scrollThumbH;
                    ulNewT = -(factH-wrapH);
                }
                scrollThumbEle.css('top',newT);
                scrollBar.css('top',ulNewT);
            })
            $(document).on('mouseup',function(){
                $(document).off('mousemove')
            })
        })
        scrollBarCon.mousewheel(function(down,e){
            ndGlobal.stopDefault(e);
            var oldT = scrollThumbEle.position().top;
            var uloldT = scrollBar.position().top;
            if (down) 
            {
                newT = oldT+30;
                ulNewT = uloldT - 30*(factH-wrapH)/(scrollTrackH-scrollThumbH);
            }else
            {
                newT = oldT-30;
                ulNewT = uloldT + 30*(factH-wrapH)/(scrollTrackH-scrollThumbH);
            }
                    
            if (newT<=0) 
            {
                newT = 0;
                ulNewT = 0;
            }else if(newT>=scrollTrackH-scrollThumbH)
            {
                newT=scrollTrackH-scrollThumbH;
                ulNewT = -(factH-wrapH);
            }
            scrollThumbEle.css('top',newT);
            scrollBar.css('top',ulNewT);
        })
	},
    // 模拟select下拉框
    customSelect : function(ele){
        ele.each(function(){
            var that = $(this);
            that.children('p').off('click');
            that.children('p').click(function(e){
                if ($('.custom-select-con',that).size()<1) {return};
                ndGlobal.stopDefault(e);
                ndGlobal.stopEvent(e);
                $scroll = $('.custom-select-con',that);
                if (!that.hasClass('custom-select-click')) {
                    // 页面上只能存在一个这样的下拉框
                    ele.removeClass('custom-select-click')
                    $('.custom-select-con',ele).hide();
                    that.addClass('custom-select-click');
                    $scroll.show();
                    ndGlobal.customScroll($scroll);
                }else{
                    that.removeClass('custom-select-click');
                    $scroll.hide();
                }
            })
            $('ul li',that).off('click');
            $('ul li',that).click(function(e){
                ndGlobal.stopEvent(e);
                $scroll = $('.custom-select-con',that);
                var $text = $(this).html();
                if ($(this).attr('data-id')) {
                    var $val = $(this).attr('data-id');
                    that.attr('data-value',$val);
                    // 如果是城市下拉框
                    if(that.hasClass('user-city')){
                        var $par = that
                        ndGlobal.getArea($par,$val)
                    }
                };
                $('p',that).html($text);
                that.removeClass('custom-select-click');
                $scroll.hide();
            })
        })
        // 点击周围表单消失
        $(document).click(function(){
            $('.custom-select-click').find('.custom-select-con').hide();
            $('.custom-select-click').removeClass('custom-select-click');
        })
        // 圈定范围
        $('.custom-select-con').click(function(e){
            ndGlobal.stopDefault(e);
            ndGlobal.stopEvent(e);
        })
    },
    // 表单
    theForm : function(ele){
        ele ? ele : ele = $('.sign-in');
        // 表单默认内容填写
        var defaults = ndGlobal.defaultParameter();
        ndGlobal.getCity(ele,defaults['cityid']);
        if (defaults['content'] != 0 || defaults['content'] != '0') {
            $('.user-accept').val(defaults['content']);
            $('.user-accept').attr('data-value',defaults['content']);
        };
        // 去除表单项的样式和模拟placeholder
        $('input',ele).focus(function(){
            var $this = $(this);
            if ($this.hasClass('error')) {
                $this.removeClass('error');
            };
            if($this.val() == $this.attr('data-value')){
                $this.val('');
                $this.css('color','#333');
            }
        });
        $('input',ele).blur(function(){
            var $this = $(this);
            if($this.val() == ""){
                $this.val($this.attr('data-value'));
                $this.css('color','#888');
            }
        })
        $('.custom-select p',ele).click(function(){
            var $par = $(this).parent('.custom-select');
            if ($par.hasClass('error')) {
                $par.removeClass('error');
            };
        })
        // 只能输入数字
        $('input.input-number').keyup(function(){
            if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}
        })
        // 判断是否深圳积分入户页面
        if(defaults.cityid == 2 && defaults.ntypeid == 73){
			// 特别表单提交
			$("head").append('<link rel="stylesheet" href="https://img.china-kaoshi.com/public/css/new_form.css">');
			var reg={
				name:/^[\u4E00-\u9FFF]+$/,
				phone:/^1[3|4|5|6|7|8|9]\d{9}$/
			}
			ele.submit(function(){
				var $form = $(this);
				$form.append('<input type="hidden" name="msg_remarks" value="" />')
				//var msg_webID     = siteId ? siteId : msg_webID_val;
				var msg_username  = $('.user-name',$form);
				var msg_userphone = $('.user-tel',$form);
				var msg_remarks   = $('input[name="msg_remarks"]',$form);
				var msg_other     = $(".user-con",$form);
				var errorMsg = "",Lacks ="";
				function alert(){//给移动端自定义弹出框
					$("body").append("<div id='msg'><img src='https://img.china-kaoshi.com/public/images/warning.png'><p>" + errorMsg + "</p><a href='#nogo'>确定</a></div><div id='msgbg'></div>");
					var top = ($(window).height()-$("#msg").height())/3;
					var left = ($(window).width()-$("#msg").width())/2;
					$("#msg").css({
						'top':top,
						'left':left
					});
					$("#msg a").click(function(){
						$("#msg,#msgbg").remove();
						if(Lacks == 1){
							msg_username.focus();
						}else if(Lacks == 2){
							msg_userphone.focus();
						}				
					});
				}
				if(!reg.name.test(msg_username.val())){
					errorMsg = "请填写您的姓名，我们为您进行备注。";		
					Lacks = 1;
					alert();
					return false;
				}
				if(!reg.phone.test(msg_userphone.val())){
					errorMsg = "请正确填写您的手机号，以便接受资料。";
					Lacks = 2;
					alert();			
					return false;
				}
				//------------------------------------------------------------------------------------------------------------------------------
				var result="";//另一种选项
				//获取当前时间
				var myDate = new Date();
				var mysj = myDate.toLocaleString( );
				result += "【"+"留言时间："+mysj+"】";
				msg_remarks.val(result);
				//------------------------------------------------------------------------------------------------------------------------------
				msg_other.each(function(){
					//判断其他控件是否属于单选和多选
					if($(this).attr("type")=="radio"||$(this).attr("type")=="checkbox"){
						if($(this).is(':checked')){
							msg_remarks.val(msg_remarks.val()+"【"+ $(this).val() +"】");
						}
					}else{
						msg_remarks.val(msg_remarks.val()+"【"+ $(this).val() +"】");
					}
				});
				console.log(msg_remarks.val());
				if(typeof(clockTime)=="undefined"){clockTime=60000;}
				$.getJSON("https://jylz.zhntu.cn/api.php?op=add_msg&callback=?",{
					"msg_webID": 1,
					"msg_url": document.location.href,
					"msg_remarks": msg_remarks.val(),
					"msg_username": msg_username.val(),
					"msg_userphone": msg_userphone.val()
				},function(json){
					if(json==401){
						errorMsg = "网站号无效，提交信息不成功，请联系我们的客服人员，谢谢。";
						alert();
						msg_remarks.val(null);
						return false;
					}
					if(json==402){
						errorMsg = "我们已经记录您提交的信息，请不要重复提交，谢谢。";
						alert();
						msg_remarks.val(null);
						return false;
					}
					if(json==1){
						errorMsg = "您已经提交成功。";
						alert();
						msg_remarks.val(null);
					}
		        });
				return false;
			})
		}
        else{
        	// 正常表单提交
        	ele.submit(function(){
	            var $form = $(this);
	            ndGlobal.checkForm($form);
	            if ($('.error',$form).size()>0) {
	                alert('请完善资料');
	                return false;
	            }else if(!ndGlobal.checkPhone.test($('.user-tel',$form).val())){ // 检测手机号码是否正确
	                var $this = $('.user-tel',$form);
	                alert(ndGlobal.errorPopup($this,'您输入的手机号码格式不正确'));
	                $this.focus();
	                return false;
	            }
	            var json = ndGlobal.ReadFields($form,defaults);
	            
	            //表单来源位置
	            if($("input[name='position']",$form).val()){
	            	json['position'] = $("input[name='position']",$form).val();
	            }
	            
	            $.ajax({
	                url:ndGlobal.formUrl,
	                type:'get',
	                async: true,
	                data:json,
	                dataType:'jsonp',
	                jsonp: "callback",
	                jsonpCallback:"call",
	                // jsonpCallback:"$callback", 
	                success:function($data){
	                    if($data.flag == 'ok'){
	                        alert($data.message);
	                    }else if($data.flag == 'no'){
	                        alert($data.message);
	                    }
	                },
	                error:function(){
	                    alert('请检查您提交的信息是否有误');
	                }
	            });
	            return false;
	        })
        }
	},
    // 读取form表单中包含的字段名,生成对象
    ReadFields : function(ele,o){
        // 城市
        if ($('.user-city',ele).size()>=1) {
            if ($('.user-city',ele).hasClass('input-required') && $('.user-city',ele).hasClass('custom-select')) {
                o['cityid'] = $('.user-city',ele).attr('data-value');
            }else if(!$('.user-city',ele).hasClass('input-required') && $('.user-city',ele).hasClass('custom-select') && $('.user-city',ele).attr('data-value') && $('.user-city',ele).attr('data-value') !="" && $('.user-city',ele).attr('data-value') != o['cityid']){
                o['cityid'] = $('.user-city',ele).attr('data-value');
            }else if($('.user-city',ele).hasClass('input-required') && $('.user-city',ele).hasClass('input-select')){
                o['cityid'] =  $('.user-city option:selected',ele).val();
            }else if(!$('.user-city',ele).hasClass('input-required') && $('.user-city',ele).hasClass('input-select') && $('.user-city option:selected',ele).val() != 0 && $('.user-city option:selected',ele).val() != o['cityid']){
                o['cityid'] =  $('.user-city option:selected',ele).val();
            }
        };
        // 区域
        if ($('.user-area',ele).size()>=1) {
            if ($('.user-area',ele).hasClass('input-required') && $('.user-area',ele).hasClass('custom-select')) {
                o['areaid'] = $('.user-area',ele).attr('data-value');
            }else if(!$('.user-area',ele).hasClass('input-required') && $('.user-area',ele).hasClass('custom-select') && $('.user-area',ele).attr('data-value') && $('.user-area',ele).attr('data-value') !="" && $('.user-area',ele).attr('data-value') != o['areaid']){
                o['areaid'] = $('.user-area',ele).attr('data-value');
            }else if($('.user-area',ele).hasClass('input-required') && $('.user-area',ele).hasClass('input-select')){
                o['areaid'] =  $('.user-area option:selected',ele).val();
            }else if(!$('.user-area',ele).hasClass('input-required') && $('.user-area',ele).hasClass('input-select') && $('.user-area option:selected',ele).val() != 0 && $('.user-city option:selected',ele).val() != o['areaid']){
                o['areaid'] =  $('.user-area option:selected',ele).val();
            }
        };
        // 咨询内容
        if ($('.user-con',ele).size()>=1) {
            var $userCon = $('.user-con',ele); 
            var $content = o['content'];
            var $len = $userCon.size();
            for (var i = 0; i < $len; i++) {
                if ($userCon.eq(i).hasClass('input-required') && $userCon.eq(i).hasClass('input-text') && $userCon.eq(i).val() != o['content']) {
                    $content += "丶" + $userCon.eq(i).val();
                }else if($userCon.eq(i).hasClass('input-required') && $userCon.eq(i).hasClass('custom-select') && $userCon.eq(i).attr('data-value') != o['content']){
                    $content += "丶" + $userCon.eq(i).attr('data-value');
                }else if($userCon.eq(i).hasClass('input-required') && $userCon.eq(i).hasClass('input-select') && $('option:selected',$userCon.eq(i)).val() != o['content']){
                    $content += "丶" + $('option:selected',$userCon.eq(i)).val();
                }else if(!$userCon.eq(i).hasClass('input-required') && $userCon.eq(i).hasClass('input-text') && $userCon.eq(i).val() != "" && $userCon.eq(i).val() != o['content']){
                    $content += "丶" + $userCon.eq(i).val();
                }else if(!$userCon.eq(i).hasClass('input-required') && $userCon.eq(i).hasClass('custom-select') && $userCon.eq(i).attr('data-value') && $userCon.eq(i).attr('data-value') !="" && $userCon.eq(i).attr('data-value') != o['content']){
                    $content += "丶" + $userCon.eq(i).attr('data-value');
                }else if(!$userCon.eq(i).hasClass('input-required') && $userCon.eq(i).hasClass('input-select') && $('option:selected',$userCon.eq(i)).val() !=0 && $('option:selected',$userCon.eq(i)).val() != o['content']){
                    $content += "丶" + $('option:selected',$userCon.eq(i)).val();
                }
                o['content'] = $content;
            };
        }
        // 用户姓名
        o['contact'] = $('.user-name',ele).val();
        // 联系电话
        o['mobile'] = $('.user-tel',ele).val();
        return o;
    },
    // 表单选项错误时的弹窗
    errorPopup : function(ele,val){
        var dataAlert;
        if (ele.attr('data-alert') && ele.attr('data-alert') !="") {
            dataAlert = ele.attr('data-alert');
        }else{
             dataAlert = val;
        }
        return dataAlert;
    },
    // 表单判断
    checkForm : function(ele){
        var $input = $('input',ele);
        var $customSelect = $('.custom-select',ele);
        $input.each(function(){  
            var $this = $(this);
            var $val = $(this).val();
            var $dataVal = $(this).attr('data-value')
            if ($this.hasClass('input-required')) {
                if ($val == $dataVal) {
                    $this.addClass('error');
                }
            }
        })
        $customSelect.each(function(){
            var $this = $(this);
            var $val = $(this).attr('data-value');
            if ($val == undefined && $this.hasClass('input-required')) {
                 $this.addClass('error');
            };
        })
    },
    // 弹出遮罩层
    popMask : function(){
        $('<div>',{
            id : 'mask-layer'
        }).appendTo('body');
    },
    // 弹出表单
    popAudition : function(){
        $('<div>',{
            id : 'popAudition'
        }).appendTo('body');
    },
    // 收藏
    addFav: function (url, title) {
        if (document.all) {
            window.external.AddFavorite(url, title)
        } else {
            try {
                window.external.addFavorite(url, title);
            } catch (e) {
                try {
                    window.sidebar.addPanel(title, url, "");
                } catch (e) {
                    alert("您可以尝试通过快捷键 Ctrl+D 加入到收藏夹~");
                }
            }
        }
        return !1;
    },
}


// 鼠标滚轮
$.fn.extend({
    mousewheel:function (Fn) {
        if (window.navigator.userAgent.indexOf("Firefox")>-1) {
            $(this).get(0).addEventListener("DOMMouseScroll",wheel,false)
        }else{
            $(this).get(0).onmousewheel = wheel;
        }

        function wheel (e) {
            var down = false;
            var e = e || window.event;
            if (e.detail) {     
                down = e.detail>0;
            }else{      
                down = e.wheelDelta<0;
            }
            Fn.call($(this).get(0),down,e)           
        }
    }
});
// tab切换
(function($){
    var defaults = {
        menu:'.title',
        box:'.box',
        cur:'cur',
        index:0,
        time:'',
        type:'mouseover',
        onload:function(index){}
    }
    $.fn.sdwTab = function(options){
        var $this = $(this);
        if(this.length == 0) return this;
        if(this.length > 1){
            this.each(function(){$(this).sdwTab(options)});
            return this;
        }
        var tab = {};
        $this.init = function(){
            tab.settings = $.extend({}, defaults, options);

            tab.aTit = $(tab.settings.menu,$this);           //移动标签
            tab.aBox = $(tab.settings.box,$this);            //移动盒子
            tab.aTit.each(function(){
                if($(this).hasClass(tab.settings.cur)){
                    tab.settings.index = $(this).index();
                    $this.showBox();
                }
            })
            $this.incident();
        }
        $this.incident = function(){
            tab.aTit.on(tab.settings.type,function(){
                tab.settings.index = $(this).index();
                $this.showBox();
            })
        }
        $this.showBox = function(){
            tab.aTit.removeClass(tab.settings.cur).eq(tab.settings.index).addClass(tab.settings.cur);
            tab.aBox.hide().eq(tab.settings.index).show();
            tab.settings.onload(tab.settings.index);
        }
        $this.init();
        return $this
    }
})(jQuery);
// $(function(){
// // 导航跟随
// 	var navTop = $('.nav').offset().top;
// 	$(document).scroll(function(){
// 		if ($(document).scrollTop()>navTop) {
// 			$('.nav').css({'position':'fixed','top': 0});
// 		}else{
// 			$('.nav').css({'position':'relative','top':'auto'});
// 		}
// 	})
// })